/*
 * FileData.java
 * 
 * last update: 14.01.2010 by Stefan Saru
 * 
 * author:	felix
 *
 * Obs: N/A
 */

package ide;
import java.io.Serializable;

/**
 *   Describes a file included in project or just opened in the editor.
 *   -if the user opens a file that isn't included in the loaded project, a FileData class
 *     will be created.
 *   -for project included files, this is serialized into tha saved project.
 *
 * @author felix 
 *     24.10.99 03:37am  
 *
 * this was an inner class of Project.
 *
 */  
@SuppressWarnings("serial")
class FileData implements Serializable
{
	public String fileName;

	/**
	 * How many views are opened for this file
	 */
	public int openCount;

	public boolean isReadOnly;  
	public boolean isModified;

	public FileData(String fileName ) {
		this.fileName = fileName;
		isModified = false;
		isReadOnly = false;
		openCount = 0;
	}

	/**
	 * computes the shortest wai to ge from prjPath to fileName
	 */
	public static String getRelative(String fileName, String prjPath) {
		if (fileName.startsWith(prjPath)) {
			return fileName.substring(prjPath.length(), fileName.length());
		}
		return null;
	}

}